/**
 * elancom Corporation copy right 2012 - 2015  
 *   
 * $Header: https://192.168.1.224/svn/elancom/product/elancom-platform/trunk/src/main/java/com/elancom/framework/util/Validator.java 1034 2012-07-02 03:09:12Z lanzhouxue $
 * $Id: Validator.java 1034 2012-07-02 03:09:12Z lanzhouxue $
 * $Author: lanzhouxue $
 * $Date: 2012-07-02 11:09:12 +0800 (Mon, 02 Jul 2012) $
 * $Revision: 1034 $
 */
package com.elancom.framework.commons.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public abstract class Validator {
	public static final String REG_MOBILE = "1[3,4,5,8]{1}\\d{9}";
	public static final Pattern PT_MOBILE = Pattern.compile(REG_MOBILE);
	public static final String REG_MAIL = "\\w+@(\\w+\\.){1,3}\\w+";
	public static final Pattern PT_EMAIL = Pattern.compile(REG_MAIL);

	public static boolean isEmail(String email) {
		boolean flag = false;
		if (email != null) {
			final Matcher matcher = PT_EMAIL.matcher(email);
			flag = matcher.matches();
		}
		return flag;
	}

	public static boolean isMobile(String mobile) {

		boolean flag = false;
		if (mobile != null) {
			final Matcher matcher = PT_MOBILE.matcher(mobile);
			flag = matcher.matches();
		}
		return flag;
	}

	public static void main(String[] args) {
		// test
	}

	private Validator() {
	}
}
